

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:ysy_flutter_mvvm_yuanxuan/helper/Constant.dart';
import 'package:ysy_flutter_mvvm_yuanxuan/helper/ImageHelper.dart';
import 'package:ysy_flutter_mvvm_yuanxuan/helper/SmartRefresherHelper.dart';
import 'package:ysy_flutter_mvvm_yuanxuan/helper/ViewHelper.dart';


class OrderWidget extends StatefulWidget {

  OrderWidget({Key? key}) : super(key: key);

  @override
  _OrderWidgetState createState() => _OrderWidgetState();
}

class _OrderWidgetState extends State<OrderWidget> with TickerProviderStateMixin{

  late TabController controller= TabController(vsync: this,length: 5);

  @override
  void initState() {
    super.initState();

  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        color: Color(ConstantColors.mainBackgroundColor),
        child: Column(
          children: [
            OrderHead(controller),
            Expanded(
              child: TabBarView(
                  controller: controller,
                  children: [
                    TabBarItem(),
                    TabBarItem(),
                    TabBarItem(),
                    TabBarItem(),
                    TabBarItem(),
                  ]),
            )
          ],
        ),
      ),
    );
  }
}

class OrderHead extends StatelessWidget {

  TabController controller;

  OrderHead(this.controller, {Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
       child:Column(
         children: [
           DufTitleBar(
             titleWidget:Container(
               alignment: Alignment.center,
                margin: EdgeInsets.fromLTRB(60.sp, 0, 60.sp, 0),
                padding: EdgeInsets.fromLTRB(20.sp, 0, 20.sp, 0),
                height: 32.sp,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(16.sp),
                  border: Border.all(color: Color(ConstantColors.mainColor),width: 0.5.sp),
                ),
               child: TextField(
                  cursorColor: Color(ConstantColors.mainColor),
                  decoration: InputDecoration(
                    border:  InputBorder.none
                  ),
               ),
             ) ,
             more: RightTag(valueNotifier: ValueNotifier(2),
             width: 40.sp,
             height: 32.sp,
             child: Image.asset(assetPath("ic_more_btn.png"),height: 3.sp,fit: BoxFit.fitHeight,)),
           ),
           TabBar(
               controller: controller,
               isScrollable: true,
               labelColor: Color(ConstantColors.mainColor),
               unselectedLabelColor: Colors.black,
               indicatorColor: Colors.transparent,
               indicatorSize: TabBarIndicatorSize.label,
               indicatorPadding: EdgeInsets.fromLTRB(0, 2.h, 0, 1.h),
               tabs: [
                  Tab(text: "全部",),
                  Tab(text: "待付款",),
                  Tab(text: "待发货",),
                  Tab(text: "待收货",),
                  Tab(text: "待评价",),
               ]
           )
         ],
       ) ,
    );
  }
}


class TabBarItem extends StatelessWidget {
  const TabBarItem({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(alignment: Alignment.center,child: Empty());
  }
}

